using System;

namespace Edge.Common.TextTemplates
{
    public class TemplateParametrInfo : IEquatable<TemplateParametrInfo>
    {
        private readonly string name;
        private readonly string description;
        private readonly Type clrType;


        public TemplateParametrInfo(string name, string description, Type clrType)
        {
            this.name = name;
            this.description = description;
            this.clrType = clrType;
        }


        public string Name
        {
            get { return name; }
        }

        public string Description
        {
            get { return description; }
        }

        public Type ClrType
        {
            get { return clrType; }
        }


        public bool Equals(TemplateParametrInfo templateParametrInfo)
        {
            if (templateParametrInfo == null) return false;
            if (!Equals(name, templateParametrInfo.name)) return false;
            if (!Equals(description, templateParametrInfo.description)) return false;
            if (!Equals(clrType, templateParametrInfo.clrType)) return false;
            return true;
        }

        public override bool Equals(object obj)
        {
            if (this == obj) return true;
            return Equals(obj as TemplateParametrInfo);
        }

        public override int GetHashCode()
        {
            int result = name != null ? name.GetHashCode() : 0;
            result = 29 * result + (description != null ? description.GetHashCode() : 0);
            result = 29 * result + (clrType != null ? clrType.GetHashCode() : 0);
            return result;
        }
    }
}